package com.framework.loippi.controller.api;

import com.framework.loippi.entity.Article;
import com.framework.loippi.service.ArticleService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * Controller - View
 *
 * @author Loippi Team
 * @version 1.0
 */
@Controller("apiViewAPIController")
public class ViewAPIController extends ApiBaseController {

    @Resource
    private ArticleService articleService;


    // 文章链接
    @RequestMapping(value = "/api/view/article/{id}", method = {RequestMethod.GET})
    public String article(@PathVariable Long id, ModelMap model) {
        Article article = articleService.find(id);
        model.addAttribute("article", article);
        return "/api/article";
    }


}
